package com.share.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.share.domain.User;
import com.share.mapper.UserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @desc:
 * @author:caifan
 * @date:2020/3/15
 */
@Service
@Transactional
@DS("ds1")
public class UserService {
    @Resource
    private UserMapper userMapper;

    public void saveUser1(User user) {
        userMapper.insert(user);
    }

    public User findById(Long id) {
        return userMapper.selectById(id);
    }

    @DS("ds2")
    public void saveUser2(User user) {
        userMapper.insert(user);
    }

}
